package com.app.business.show;

import com.app.business.model.*;
import com.app.business.service.*;
import com.app.system.permission.service.DataDictService;
import com.app.system.utils.ParamUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 大屏公示（没有权限限制）
 * Created by ddz on 2022/10/17.
 */
@Controller
@RequestMapping("/showForHjTwoForBuild/*")
@SuppressWarnings("all")
public class ShowForHjTwoForBuild {
    @Autowired
    private ContractService contractService;
    @Autowired
    private ZsProjectService zsProjectService;
    @Autowired
    private AzProjectService azProjectService;
    @Autowired
    private DataDictService dataDictService;
    @Autowired
    private HouseService houseService;
    @Autowired
    private CarLotService carLotService;
    @Autowired
    private StorageRoomService storageRoomService;
    @Autowired
    private StatisticsService statisticsService;


    /**
     * 大屏主界面
     */
    @RequestMapping("tv")
    public void tv(ModelMap modelMap) {
    }


    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("housePic")
    public void housePic(HttpServletRequest request, ModelMap modelMap) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        Integer azProjectId = ParamUtils.getInt(request, "azProjectId", 0);
        Integer maxFloor = ParamUtils.getInt(request, "maxFloor", 0);
        Integer minFloor = ParamUtils.getInt(request, "minFloor", 0);
        String buildNum = ParamUtils.getString(request, "buildNum", "");
        String floorListStr = ParamUtils.getString(request, "floorList", "");
        List<Integer> floorList = new ArrayList<>();
        if (floorListStr != null && !floorListStr.equals("")) {
            String[] strs = floorListStr.split(",");
            for (String str : strs) {
                int i = Integer.parseInt(str);
                floorList.add(i);
            }
        }

        //通过征收项目、安置项目、楼号得到所分配的houseList
        List<House> houseList = houseService.houseList(zsProjectIdStr, azProjectId, buildNum, floorListStr);
        //得到层号和当前楼层的List<House>对应的map
        Map<String, List<House>> floorHouseMap = houseService.getFloorHouseMap(houseList);
        //获取当前安置项目最高层
        Map<String, Integer> maxFloorMap = houseService.getMaxFloorMap(zsProjectIdStr, azProjectId, buildNum);

        //房源状态
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        //房屋类型
        Map<String, String> houseHoldMap = this.dataDictService.getMapByParentNameForValue_Name("房屋户型");

        modelMap.addAttribute("buildNum", buildNum);
        modelMap.addAttribute("floorHouseMap", floorHouseMap);
        modelMap.addAttribute("maxFloor", maxFloor);
        modelMap.addAttribute("minFloor", minFloor);
        modelMap.addAttribute("colorMap", colorMap);
        modelMap.addAttribute("houseHoldMap", houseHoldMap);
    }


    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo1")
    public void houseShowHjTwo1(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }


    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo2")
    public void houseShowHjTwo2(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo3")
    public void houseShowHjTwo3(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo4")
    public void houseShowHjTwo4(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo5")
    public void houseShowHjTwo5(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo6")
    public void houseShowHjTwo6(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);

    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo7")
    public void houseShowHjTwo7(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo8")
    public void houseShowHjTwo8(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo9")
    public void houseShowHjTwo9(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo10")
    public void houseShowHjTwo10(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }

    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo11")
    public void houseShowHjTwo11(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }
    /**
     * 湖滨二期
     */
    @RequestMapping("houseShowHjTwo12")
    public void houseShowHjTwo12(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }


    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd2ForNum2_3")
    public void houseBuildPicHjTwoTd2ForNum2_3(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd2ForNum3_5")
    public void houseBuildPicHjTwoTd2ForNum3_5(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd3")
    public void houseBuildPicHjTwoTd3(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd4")
    public void houseBuildPicHjTwoTd4(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd4ForNum2_3_7_8")
    public void houseBuildPicHjTwoTd4ForNum2_3_7_8(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd5")
    public void houseBuildPicHjTwoTd5(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd6")
    public void houseBuildPicHjTwoTd6(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd7")
    public void houseBuildPicHjTwoTd7(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("houseBuildPicHjTwoTd8")
    public void houseBuildPicHjTwoTd8(HttpServletRequest request, ModelMap modelMap) {
        this.housePic(request, modelMap);
    }
}
